
#!coding:utf-8
# vim: tabstop=4 shiftwidth=4 softtabstop=4
"""
    @author jay.han
"""
from lxml import etree
import logging

from cvirt.cnode.libvirtXmlObject.baseDomain import GuestDevice

LOG = logging.getLogger(__name__)

class GuestFilesys(GuestDevice):
    ROOT_NAME = 'filesystem'
    def __init__(self, parse_xml=None, **kw):
        super(GuestFilesys, self).__init__(parse_xml=parse_xml,**kw)

        self.source_type = "mount"
        self.source_dir = None
        self.target_dir = "/"

    def _get_xml_config(self, root):
        dev = root

        dev.set("type", self.source_type)

        dev.append(etree.Element("source", dir=self.source_dir))
        dev.append(etree.Element("target", dir=self.target_dir))

        return dev

